package com.cskaoyan.demo;

import com.cskaoyan.utils.DruidUtils;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.ScalarHandler;

import java.sql.SQLException;

//ScalarHandler
public class QueryRunnerDemo5 {

    public static void main(String[] args) throws SQLException {

        QueryRunner queryRunner = new QueryRunner(DruidUtils.getDataSource());

        Long number = queryRunner.query("select count(id) from user", new ScalarHandler<>());

        System.out.println(number);
    }
}
